package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.pojo.*;
import com.itheima.service.DishClientService;
import com.itheima.service.SetmealClientService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import sun.security.util.math.ImmutableIntegerModuloP;

import java.util.List;

/**
 * @author wuyiqiang
 * @2022/6/18 16:53
 */
@RestController
@RequestMapping(value = "setmeal", produces = "application/json;charset=utf-8")
public class SetmealClientController {

    @Autowired
    private SetmealClientService setmealClientService;

    /**
     * 根据id查询菜品信息
     * @param id
     * @return
     */
    @GetMapping("/dish/{id}")
    public R<List<Dish>> findById(@PathVariable("id") String id) {
        return setmealClientService.findDish(id);
    }

    /**
     * 查询类别中大套餐
     * @param categoryId
     * @param status
     * @return
     */
    @GetMapping("/list")
    public R<List<Setmeal>> selectDish(@Param("categoryId") String categoryId, @Param("status")Integer status){
      return   setmealClientService.selectDish(categoryId,status);
    }
}
